package com.atlin.project.job.cycle;

import com.atlin.project.service.ChartService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author atlin
 * @description 重试当日生成失败的图表
 * @createDate 2024/11/23 23:25
 */
@Component
@Slf4j
public class ChartRetryTask {

    @Resource
    private ChartService chartService;


    /**
     * 每日 00:09:00秒执行
     */
    @Scheduled(cron = "0 9 0 * * ?")
    public void retryTask() {
        log.info("ChartRetryTask retryTask start");
        try {
            chartService.autoRetry();
            log.info("ChartRetryTask retryTask success");
        } catch (Exception e) {
            log.error("ChartRetryTask retryTask failed", e);
        }
    }

}
